package com.fly.container.service;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

/**
 * @author Mr.Fu
 * @date 2024/10/6 下午4:06
 */
//@Component
public class MyBeanPostProcessor implements BeanPostProcessor {

    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        if ("transactionalService".equals(beanName) || "searchService".equals(beanName) || "blogService".equals(beanName)
                || "departmentService".equals(beanName) || "retryService".equals(beanName)) {
            System.out.println("before init current bean is " + beanName);
        }
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        if ("transactionalService".equals(beanName) || "searchService".equals(beanName) || "blogService".equals(beanName)
                || "departmentService".equals(beanName) || "retryService".equals(beanName)) {
            System.out.println("after init current bean is " + beanName);
        }
        return bean;
    }
}
